package slash.entities;

import java.util.HashMap;

import org.newdawn.slick.Animation;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.util.Log;

import slash.MainGame;

public class LivingEntity extends AbstractEntity{
	
	/** hashmap stores animations the entity uses */
	private HashMap<String,Animation> animations = new HashMap <String,Animation>();
	/** String key name for animation in hashmap */
	private String currentAnimation;
	
	public LivingEntity(float x, float y) {
		super(x, y);
		this.setCollidable(true);
		try{
			initAnimations();
		}catch(SlickException e){
			Log.error("Animations couldn't be loaded", e);
		}
	}

	public HashMap<String, Animation> getAnimations() {
		return animations;
	}
	
	public String getCurrentAnimation() {
		return currentAnimation;
	}

	public void setCurrentAnimation(String currentAnimation) {
		this.currentAnimation = currentAnimation;
	}

	public void setAnimations(HashMap<String, Animation> animations) {
		this.animations = animations;
	}

	/**
	 * Initializes animations for entity
	 */
	public void initAnimations() throws SlickException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void update(GameContainer container, int time) {
		super.update(container, time);
	}

	@Override
	public void render(Graphics g) {
		super.render(g);
		g.drawAnimation(animations.get(currentAnimation), this.getPosX(), this.getPosY());
		// renders current animation at current location of entity
		// this.currentAnimation.draw(this.posX, this.posY);
	}

}
